package com.dennytech.tac.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.dennytech.tac.model.Attraction;
import com.dennytech.tac.R;

public class AttractionListItem extends LinearLayout {

	NetworkThumbView icon;
	TextView title;
	TextView intro;
	ImageView power;

	public AttractionListItem(Context context) {
		super(context);
	}

	public AttractionListItem(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	@Override
	protected void onFinishInflate() {
		super.onFinishInflate();
		icon = (NetworkThumbView) findViewById(R.id.icon);
		title = (TextView) findViewById(R.id.title);
		intro = (TextView) findViewById(R.id.intro);
		power = (ImageView) findViewById(R.id.jian);
	}

	public void setAttraction(Attraction at) {
		icon.setImage(at.getSPhotoUrl());
		title.setText(at.getName());
		intro.setText(at.getIntro());
		power.setVisibility(at.getHot() > 3 ? View.VISIBLE : View.GONE);
	}

}
